<?php

/**
 * Model class for notifications
 */
class Task extends GeneralNotification {
    
    private $deadline;
    
    function __construct() {
        $this->setType(2);
        $this->setDeadline(date("Y-m-d", time()));
    }
    
    public function getDeadline() {
        return $this->deadline;
    }

    public function setDeadline($deadline) {
        $this->deadline = $deadline;
    }

    public function toString() {
        $result = parent::toString();
        $result .= 'Deadline = '.$this->getDeadline().'<br />';
    }
    
    public function getRemainingDays(){
        $today = strtotime(date("Y-m-d", time()));
        $deadline = strtotime($this->getDeadline());
        
        $diff = $deadline - $today;
        $days = $diff / (24*60*60);
        
        return $days;
    }

}

?>